<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>31. 批量使用正则完成密码验证</title>
    </head>
    <body>
<input type="text" name="password"  />
    </body>
    <script>
        //多条规则进行密码验证
      const input=  document.querySelector(`[name="password"]`)
        input.addEventListener("keyup",e=>{
            const value=e.target.value;
            const regs=[
                /^[a-z0-9]{5,10}$/i,
                /[A-Z]/,
                /[0-9]/
            ] 
            //every 所有条件满足 才返回为真
           let state= regs.every(e=>e.test(value));
           console.log(state?"正确":"错误")
        })
       
    </script>
</html>
